<?php
$sql = "SELECT * FROM wwk_chat_msg order by ID desc limit 10";
$sql = "SELECT * FROM (" . $sql . ") as ch order by ID asc";
$echo_msg = mysql_query($sql);
while($msg = mysql_fetch_array($echo_msg)) {
  $dataInfo[] = $msg;
}
$dataInfo = json_encode($dataInfo);
$user_info = mysql_query("SELECT * FROM wwk_chat_user WHERE username='{$username}'");
$user = mysql_fetch_array($user_info);
$limitsql = mysql_query("select * from wwk_chat_user");
$limitinfo = mysql_fetch_array($limitsql);
if (!$user) {
  if ($username) {
    $add_sql = "insert into wwk_chat_user values(null, '{$username}', '{$limitinfo['password']}', 0, '', '', '1', '1')";
    $result = mysql_query($add_sql);
    $user_info = mysql_query("SELECT * FROM wwk_chat_user WHERE username='{$username}'");
    $user = mysql_fetch_array($user_info);
  }else {
    exit;
  }
}

$user_vip = $user['vip'];
$img_src  =  $user['img'];
$nickname = $user['nickname'];
//管理员
$admin = $user['type'];
$talk = $user['talk'];
$coin = $user['password'];
$limit = $user['password'];

?>
